package com.haocang.filedemo.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;

public class MyMessageHandler implements MessageHandler {

    private static Logger logger = LoggerFactory.getLogger(MyMessageHandler.class);

    @Override
    public void handleMessage(Message<?> message) throws MessagingException {
        String topic = message.getHeaders().get("mqtt_receivedTopic").toString();
        logger.info("获取消息:{}",message.getPayload().toString());
    }
}
